package crp.core.student.domain.services;

import com.qwlabs.panache.Ranged;
import crp.core.student.domain.models.StudentEntity;
import crp.core.student.domain.repositories.StudentRepository;
import io.quarkus.panache.common.Range;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import java.util.Set;
import java.util.stream.Stream;

@ApplicationScoped
public class StudentSearcher {
    private final StudentRepository studentRepository;

    @Inject
    public StudentSearcher(StudentRepository facultyRepository) {
        this.studentRepository = facultyRepository;
    }

    public Stream<StudentEntity> findByIds(Set<String> ids) {
        return studentRepository.findByIds(ids);
    }

    public Ranged<StudentEntity> findBy(String courseId, Range range) {
        return Ranged.of(studentRepository.findBy(courseId), range);
    }
}